{extend name="template/base" /}

{block name="style"}
    <link href="//cdn.bootcss.com/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet">
{/block}

{block name="content"}
<div class="pd-10 mt-30 master">
	<!-- 按钮组 -->
	<div class="cl pd-5 bg-1 bk-gray"> 
		{if condition="showAuth('admin/AdminUser/add_proc')"}
			<span class="f-l mr-5">
				<a class="btn btn-primary radius add-btn" data-title="添加用户" data-url="{:url('add_proc')}" href="javascript:;"><i class="Hui-iconfont">&#xe600;</i> 添加用户</a>
			</span>
		{/if}

		{if condition="showAuth('admin/AdminUser/batch_proc')"}
			{if condition="showAuth('admin/AdminUser/delete')"}
				<span class="f-l mr-5">
					<a class="btn btn-danger batch-btn radius" data-title="删除" data-type="delete" data-url="{:url('batch_proc')}" href="javascript:;"><i class="Hui-iconfont">&#xe6e2;</i> 批量删除</a>
				</span>
			{/if}

			<span class="f-l mr-5">
				<a class="btn btn-danger-outline batch-btn radius" data-title="禁用" data-type="disable" data-url="{:url('batch_proc')}" href="javascript:;"><i class="Hui-iconfont">&#xe631;</i> 批量禁用</a>
			</span> 

			<span class="f-l mr-5">
				<a class="btn btn-success-outline batch-btn radius" data-title="恢复" data-type="enable" data-url="{:url('batch_proc')}" href="javascript:;"><i class="Hui-iconfont">&#xe6a8;</i> 批量恢复</a>
			</span> 
		{/if}
	</div>
	<!-- 搜索框 -->
	<div class="pd-5 bg-1 bk-gray">
		<form action="{:url('/admin/admin_user/index')}" class="form-inline" role="form" id="search-form">
			<input name="username" value="{$username}" type="text" class="form-control"  placeholder="用户名称">

			<div class="form-group">
				<input type="text" class="form-control datepicker-style start" name="start" value="{$start}" placeholder="最后登录时间开始" readonly />
				~ 
				<input type="text" class="form-control datepicker-style stop" name="stop" value="{$stop}" placeholder="最后登录时间结束" readonly />
			</div>

			<div class="radio-box">
				<input type="radio" id="s-1" name="status" value="1" {$status==1? 'checked' : ''}>
				<label for="s-1">启用</label>
			</div>
			<div class="radio-box">
				<input type="radio" id="s-2" name="status" value="2" {$status==2? 'checked' : ''}>
				<label for="s-2">禁用</label>
			</div>

			<button type="submit" class="btn btn-secondary radius">搜索  </button>
			<button type="reset" class="btn btn-default radius">重置  </button>

		</form>
	</div>
	<!-- 主列表 -->
	<table class="table table-border table-bordered table-hover table-bg table-sort">
		<thead>
			<tr>
				<th scope="col" colspan="6" class="text-c"><h3>用户列表</h3></th>
			</tr>
			<tr class="text-c">
				<th width="10%">
				    <input type="checkbox" id="checkbox-1" class="select_all">
				    <label for="checkbox-1">全选</label>
				</th>
				<th>帐号</th>
				<th>登录次数</th>
				<th>最后登录时间</th>
				<th>状态</th>
				<th>操作</th>
			</tr>
		</thead>
			<tbody>
		{volist name="info" id="v"}
				<tr class="text-c">
					<td class="text-c" width="5%"><input type="checkbox" name="user_id[]" class="ic-checkbox index-chkbox" value="{$v.id}" /></td>
					<td>{$v.username}</td>
					<td>{$v.login_count}</td>
					<td>{$v.last_login_time|date="Y-m-d H:i:s",###}</td>
					<td>{$v.status? '<span class="label label-success radius">启用</span>' : '<span class="label label-danger radius">禁用</span>'}</td>
					<td >
						{if condition="showAuth('admin/AdminUser/details')"}
							<input class="btn btn-primary  radius  size-S details-btn" type="button" data-url="{:url('details',['id'=>$v.id])}" data-title="详情" value="详情">
						{/if}
						{if condition="showAuth('admin/AdminUser/edit')"}
							<input class="btn btn-default  radius  size-S edit-btn" data-url="{:url('edit',['id' => $v.id])}"  type="button"  value="编辑">
						{/if}
						{if condition="showAuth('admin/AdminUser/delete')"}
							{if condition="$v.isdelete"}
								<input class="btn btn-danger radius  size-S delete-btn" data-url="{:url('delete')}" data-id="{$v.id}" type="button" value="删除">
							{/if}
						{/if}

					</td>
				</tr>
		{/volist}
			</tbody>
	</table>
	<!-- 分页 -->
	<div class="ml-10">
	    {$info->render()}
	</div>
</div>

<!-- 添加弹框 -->
{include file="admin_user/add" /}
{/block}



{block name="script"}
	<script type="text/javascript" src="__AJS__/admin_user/index.js"></script>
{/block}